/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-07-28
 * Time: 15:04
 * To BE A Better Person-2020-3-2
 */
public class TestDemo {
    public static char repeatedCharacter(String s) {
        int[] arr=new int[26];
        int ret=0;
        int i=0;
        for(;i<s.length();i++){
           int index= ((int)(s.charAt(i)))-97;
            arr[index]++;
            if(arr[index]==2){
                break;
            }
        }
        return s.charAt(i);
    }
    public static int equalPairs(int[][] grid) {
        int time=0;
        for(int i=0;i<grid.length;i++){
            for(int j=0;j< grid[0].length;j++){
                int k=0;
                while (k<grid.length){
                    if(grid[i][k]!=grid[k][j]){
                        break;
                    }
                    k++;
                }
                if(k== grid.length){
                    time++;
                }
            }
        }
        return time;
    }
    public static void main(String[] args) {
        int[][] arr={{3,2,1},{1,7,6},{2,7,7}};
        int ret=equalPairs(arr);
        System.out.println(ret);
    }
}
